$(document).ready(function(){
    init();
});

function init(){
    $.ajax({
        url: "/user/initName",
        type: 'GET',
        data: {},
        dataType: "JSON",
        async: false,
        success: function (res) {
            var html = "";
            if (res.code === "200") {
                html += "您好,";
                html += res.data.trueName;
                html += ",欢迎使用本系统";
                $(".username").html(html);
            } else {
                alert(res.msg);
                window.location.href = "/loginout";
            }
        },
        error: function (e) {
            alert('发生错误')
        }
    })

}
